<%@ page import="service.MembersInfoService" %>
<%@ page import="entity.MembersInfo" %>
<%@ page import="java.util.List" %>
<%@ page import="java.sql.SQLException" %><%--
  Created by IntelliJ IDEA.
  User: 86134
  Date: 2024/10/11
  Time: 9:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Members Information</title>
    <style>
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th, td {
            padding: 8px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }
        tr:nth-child(even) {background-color: #f2f2f2;}
        th {
            background-color: #4CAF50;
            color: white;
        }
    </style>
</head>
<body>
    <h1>成员信息</h1>
    <table>
        <thead>
            <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Gender</th>
                <th>Age</th>
                <th>Address</th>
                <th>Email</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            <%
                MembersInfoService membersInfoService = new MembersInfoService();
                List<MembersInfo> members = null;
                try {
                    members = membersInfoService.getAllMembers();
                } catch (Exception e) {
                    e.printStackTrace();
                }

                if (members != null) {
                    for (MembersInfo member : members) {
                        %>
                        <tr>
                            <td><%= member.getMid() %></td>
                            <td><%= member.getMname() %></td>
                            <td><%= member.getMgender() %></td>
                            <td><%= member.getMage() %></td>
                            <td><%= member.getMaddress() %></td>
                            <td><%= member.getMemail() %></td>
                            <td>
                                <a href="MembersInfoServlet?method=delete&id=<%= member.getMid() %>">删除</a>
                                <a href="UpdateMember.jsp?id=<%= member.getMid() %>">更新</a>
                            </td>
                        </tr>
                        <%
                    }
                } else {
                }
            %>
        </tbody>
    </table>
</body>
</html>


